<?php 
$GLOBALS['Md'] = "TimeClock";
$GLOBALS['Pd'] = "B";
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
print heade(); 
print body(); 
module($BSD['DB00']);
office_header($_SESSION[$SESSOF]);
include($GLOBALS['PAD']."Modules/Exchange/main.obj.php");
include($GLOBALS['PAD']."Modules/Exchange/nav.views.php");
print NavBack();

if (isset($_POST['SaveRates'])) {

	if ($_POST['tax_value'] != "") {
	$expense_time = mk_time("Current","time");
	
	$CSave = "INSERT INTO exchange_expenses (tax_value, other, expense_time, name)
	VALUES 
	('{$_POST['tax_value']}','{$_POST['other']}','{$GLOBALS['T']}','{$_POST['name']}')";
	$Save = $GLOBALS['CONN']->db_query($CSave);
	print "Dados guardados com sucesso.";
	} else {
	print "Preencha todos os campos.";
	}
}
?>
<table width="100%"  border="0" cellpadding="10">
  <tr>
    <td><table width="100%"  border="0" cellpadding="10" cellspacing="2">
        <form action="index.php" method="post">
	<?php  
	$QCallMain = "SELECT * FROM exchange_expenses WHERE name = 'Comiss�o BPN' ORDER BY expense_time DESC LIMIT 0,1";
	$CallMain = $GLOBALS['CONN']->db_array($QCallMain);
	for ($m = 1; $m <= $CallMain[0]; $m++) { 
	?>
          <tr bgcolor="#99CCCC">
            <td bgcolor="#99CCCC">Custos BPN - Despesas</td>
            <td>Valor</td>
          </tr>
          <tr bgcolor="#F2F2F2">
            <td>ComissÃo:<input type="hidden" name="name" value="Comiss�o BPN"></td>
            <td><input name="tax_value" type="text" id="tax_value" value="<?php echo $CallMain[$m]['tax_value'];?>" size="8" maxlength="12">
            &euro;</td>
          </tr>
          <tr bgcolor="#F2F2F2">
            <td>Imposto de selo:
  </td>
            <td><input name="other" type="text" id="other" value="<?php echo $CallMain[$m]['other'];?>" size="8" maxlength="12">
            &euro;</td>
          </tr>
          <tr bgcolor="#F2F2F2">
            <td>Data:
                <?php echo form_input_time("Current",$GLOBALS['T']);?>
            </td>
            <td><input name="SaveOther" type="submit" id="SaveOther" value="Salvar"></td>
          </tr>
		  <?php } ?>
        </form>
    </table>
      <br>
      <table width="100%"  border="0" cellpadding="10" cellspacing="2">
        <form action="index.php" method="post">
	<?php  
	$QCallMain = "SELECT * FROM exchange_expenses WHERE name = 'Grupo 8 - Transporte de Malotes' ORDER BY expense_time DESC LIMIT 0,1";
	$CallMain = $GLOBALS['CONN']->db_array($QCallMain);
	for ($m = 1; $m <= $CallMain[0]; $m++) { 
	?>
          <tr bgcolor="#99CCCC">
            <td bgcolor="#99CCCC">Custo de Transporte <input type="hidden" name="name" value="Grupo 8 - Transporte de Malotes"></td>
            <td>Valor</td>
          </tr>
          <tr bgcolor="#F2F2F2">
            <td>Malotes (Grupo 8):</td>
            <td><input name="tax_value" type="text" id="tax_value" value="<?php echo $CallMain[$m]['tax_value'];?>" size="8" maxlength="12">
&euro;</td>
          </tr>
          <tr bgcolor="#F2F2F2">
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr bgcolor="#F2F2F2">
            <td>Data:
                <?php echo form_input_time("Current",$GLOBALS['T']);?>
            </td>
            <td><input name="SaveOther" type="submit" id="SaveOther" value="Salvar"></td>
          </tr>
		 <?php } ?>
        </form>
      </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
<?php print footer(); ?>